from scipy.optimize import linprog
import numpy as np
c = np.array([-0.75,
              -0.7753,
              0.375,
              783/1750,
              0.35,
              -0.65,
              -0.8611,
              -(2.3-12*321/10000-783*11/7000)])
#计算目标函数的系数矩阵一定要仔细，别像我一样因为少了一个负号一直算不对呜呜呜
A_ub = np.array([[5,0,0,0,0, 10, 0,0],
                 [0,7,0,0,0,0,9,12],
                 [0,0,6,0,0,8,8,0],
                 [0,0,0,4,0,0,0,11],
                 [0,0,0,0,7,0,0,0]])
b_ub = np.array([6000,
                 10000,
                 4000,
                 7000,
                 4000])
A_eq = np.array([[1,1,-1,-1,-1,0,0,0]])
b_eq = np.array([0])
x1 = [0, np.inf]
x2 = [0, np.inf]
x3 = [0, np.inf]
x4 = [0, np.inf]
x5 = [0, np.inf]
x6 = [0, np.inf]
x7 = [0, np.inf]
x8 = [0, np.inf]
res = linprog(c, A_ub, b_ub, A_eq, b_eq, bounds=(x1, x2, x3, x4, x5, x6, x7, x8))
print(res)
